import Vue from 'vue'
// 按需导入Element UI组件
import {
  Upload,
  Message,
  Scrollbar,
  Notification,
  Button,
  Image,
  Input,
  Breadcrumb,
  BreadcrumbItem,
  Dialog,
  Select,
  Option,
  Menu,
  MenuItem,
  Popover,
  Drawer,
  Avatar,
  InputNumber,
  Progress,
  Form,
  FormItem,
  Tag,
  Table,
  TableColumn,
  Checkbox,
  Pagination,
  Submenu,
  Loading // 新增Loading组件导入
} from 'element-ui'
// 组件列表
const elementComponents = {
  Submenu,
  Pagination,
  Upload,
  Button,
  Scrollbar,
  Image,
  Input,
  Breadcrumb,
  BreadcrumbItem,
  Dialog,
  Select,
  Option,
  Menu,
  MenuItem,
  Popover,
  Drawer,
  Avatar,
  InputNumber,
  Progress,
  Form,
  FormItem,
  Tag,
  Table,
  TableColumn,
  Checkbox
}
// 注册Element UI组件
Object.entries(elementComponents).forEach(([componentName, component]) => {
  Vue.component(component.name, component)
})
// 注册全局消息提示
Vue.prototype.$message = Message
// 注册全局通知
Vue.prototype.$notify = Notification
// 注册全局Loading服务
Vue.use(Loading.directive, {
  spinner: 'el-icon-loading',
  background: 'rgba(0, 0, 0, 0.7)'
})
